<!--暂时不做-->
<template>
  <div class="mb20">
    <jxf-titletip title="结算详情" :hasRefresh="false" :hasGoBack="true"
                  @goBack="$emit('update:isShowDetail', false)"></jxf-titletip>
    <el-card class="jxf-table-card mt20">
      <div slot="header">
        <span>数据列表</span>
      </div>
      <jxf-table :table="tableInfo">
        <template slot="type" slot-scope="scope">
          <span>{{scope.row.type === 1 ? "入账" : scope.row.type === 2 ? "出账" : ""}}</span>
        </template>
        <template slot="transCode" slot-scope="scope">
            <span>{{scope.row.transCode === 1 ? "订单结算" : scope.row.transCode === 2 ? "转出金额" : scope.row.transCode === 3 ? "转出保理手续费" : ""}}
            </span>
        </template>
      </jxf-table>
    </el-card>
  </div>
</template>

<script>
  import formatDate from '@/assets/js/formatDate'

  export default {
    name: "SupplierSettlementAcountFlowDetail",
    props: {
      isShowDetail: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        auditInfo: {
          status: null
        },
        tableInfo: {}
      }
    },
    methods: {
      // 列表初始化
      init() {
        this.tableInfo = {
          headerStyle: {background: '#f9f9f9'},
          border: true,
          loading: true,
          tr: [
            {
              id: '1',
              label: '供应商结算账户号码',
              prop: 'applyNo',
            },
            {
              id: '2',
              label: '关联订单编号',
              prop: 'orderNo'
            },
            {
              id: '3',
              label: '结算金额',
              prop: 'settleAmount'
            },
            {
              id: '4',
              label: '事项',
              prop: 'type'
            },
            {
              id: '5',
              label: '摘要',
              prop: 'transCode'
            },
            {
              id: '6',
              label: '时间',
              prop: 'settleTime'
            },
            {
              id: '7',
              label: '目的地账号号码',
              show: "template",
              prop: 'rate'
            }],
          data: []
        }
      },
      getSettleRunningOrderList(id) {
        ajax.get(apis.factory.getSettleRunningOrderList, {tradeId: id})
          .then(res => {
            if (res.success === true) {
              if (res.data !== [] && res.data !== null) {
                this.tableInfo.data = this.formatshowData(res.data)
              } else {
                this.tableInfo.data = []
              }
              this.tableInfo.loading = false
            }
          })
      },
      // 数据处理
      formatshowData(info) {
        return info.map(item => {
          return {
            applyNo: item.applyNo,
            orderNo: item.orderNo,
            payTime: item.payTime !== null && item.payTime !== "" ? formatDate.timeFormat(item.payTime) : "",
            applyTime: item.applyTime !== null && item.applyTime !== "" ? formatDate.timeFormat(item.applyTime) : "",
            amount: item.amount,
            count: item.count,
            rate: item.rate,
            facAmount: item.facAmount,
            actualAmount: item.actualAmount,
            settleTime: item.settleTime !== null && item.settleTime !== "" ? formatDate.timeFormat(item.settleTime) : ""
          }
        })
      }
    },
    created() {
      this.init()
    }
  }
</script>

<style lang="scss" scoped>

</style>
